using Prisa.Entities;

using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Prisa.DataAccess.Mapping
{
    public class CLIENTEMap : EntityTypeConfiguration<CLIENTE>
    {
        public CLIENTEMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.DniRuc)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.NombreRazonSocial)
                .IsRequired()
                .HasMaxLength(350);

            this.Property(t => t.Direccion)
                .IsRequired()
                .HasMaxLength(350);

            this.Property(t => t.Telefono)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Email)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("CLIENTE");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.DniRuc).HasColumnName("DniRuc");
            this.Property(t => t.NombreRazonSocial).HasColumnName("NombreRazonSocial");
            this.Property(t => t.Direccion).HasColumnName("Direccion");
            this.Property(t => t.Telefono).HasColumnName("Telefono");
            this.Property(t => t.Email).HasColumnName("Email");
        }
    }
}
